<?php
/**
 * 管理员后台控制器
 * 
 * @version $Id: Site.php 279 2012-04-24 14:24:13Z linsir123 $
 */
class controllerSite extends Controller   
{
	/**
	 * 登录页
	 */
	public function actionLxs()
	{
		if (MA::admin()->isLogin()) 
			lpUrl::_r('admin/main');
			
		///
		if (Request::isAjax() && Request::isPost()) {
			$con = App::C('Captcha');
			if ($con->check($_POST['captcha'])) 
				echo MA::admin()->login($_POST['username'], $_POST['password']) ? "0" : "2";
			else 
				echo "1";
				
			exit();
		}
		
		View::display('login');
	}
	
	/**
	 * 验证码
	 */
	public function actionCaptcha()
	{
		$con = App::C('Captcha');
		$con->display(1, array('bordercolor'=>'#C5C5C5', 'width'=>148, 'height'=>26));
	}
	
	/**
	 * 登出
	 */
	public function actionLogout()
	{
		MA::admin()->logout();
		lpUrl::_r('admin');
	}
	
	/**
	 * 404
	 */
	public function actionMiss() {}
}
